package cn.gzdf.sboot01.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BmiController {
    @RequestMapping("/bmi")
    @ResponseBody//将方法的返回值以字符串的形式响应给客户端
    //在方法的参数上写上要接收参数名称，和页面提交数据名称要一致，由框架帮你赋值
    public String bmi(double height,double weight){
        System.out.println("height = " + height + ", weight = " + weight);
        double bmi = weight/(height*height);
        if (bmi<18.5) return "瘦了";
        if (bmi<24)return "刚刚好";
        if(bmi<28) return "微微胖";
        return "少吃点";
    }
}
